package com.xy.realm;


import com.xy.model.Permission;
import com.xy.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

@Service
public class ShiroService {


    @Autowired
    PermissionService permissionService;
    public Map<String,String> permsMap(){
        Map<String,String> map = new LinkedHashMap<String,String>();
        map.put("/login","anon");
        List<Permission> permissionList = permissionService.getPermissionAll();
        for (Permission permission:permissionList) {
            map.put(permission.getUrl(),"perms["+ permission.getPersFlag()+"]");
        }
        return map;
    }
}
